package com.sgcc.pda.frme.protocol.ws.sendbean;

import androidx.annotation.NonNull;

import com.sgcc.pda.frme.protocol.ws.DataConvert;

/**
 * @author guorongxin
 * @date 2020/3/25
 * @fileName hw
 * @Description
 * @special 如修改此类请在下方添加备注并告知创建者，谢谢配合！
 * @VERSION 1.0
 */
public class EpcPanCun2005 {

    /**
     * 标签区域
     */
    private String labelSpace;

    /**
     * 选择标志
     */
    private String choiceSpace;

    /**
     * 盘存模式
     */
    private String pancunModel;

    /**
     * 盘存周期
     */
    private String pancunTime;

    /**
     * TID读取长度
     */
    private String tidLength;

    public String getLabelSpace() {
        return labelSpace;
    }

    public void setLabelSpace(String labelSpace) {
        this.labelSpace = labelSpace;
    }

    public String getChoiceSpace() {
        return choiceSpace;
    }

    public void setChoiceSpace(String choiceSpace) {
        this.choiceSpace = choiceSpace;
    }

    public String getPancunModel() {
        return pancunModel;
    }

    public void setPancunModel(String pancunModel) {
        this.pancunModel = pancunModel;
    }

    public String getPancunTime() {
        return pancunTime;
    }

    public void setPancunTime(String pancunTime) {
        this.pancunTime = pancunTime;
    }

    public String getTidLength() {
        return tidLength;
    }

    public void setTidLength(String tidLength) {
        this.tidLength = tidLength;
    }

    @NonNull
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();

        if (null == labelSpace) {
            return null;
        }
        labelSpace = DataConvert.toHexString(Integer.valueOf(labelSpace), 1);
        sb.append(labelSpace);


        if (null == choiceSpace) {
            return null;
        }
        choiceSpace = DataConvert.toHexString(Integer.valueOf(choiceSpace), 1);
        sb.append(choiceSpace);


        if (null == pancunModel) {
            return null;
        }
        pancunModel = DataConvert.toHexString(Integer.valueOf(pancunModel), 1);
        sb.append(pancunModel);


        if (null == pancunTime || "".equals(pancunTime)) {
            return null;
        }
        pancunTime = DataConvert.toHexString(Integer.valueOf(pancunTime), 4);
        sb.append(DataConvert.strReverse(pancunTime, 0, pancunTime.length()));


        if (!"00".equals(labelSpace)) {
            if (null == tidLength) {
                return null;
            }
            tidLength = DataConvert.toHexString(Integer.valueOf(tidLength), 1);
            sb.append(tidLength);
        }
        return sb.toString();
    }
}
